home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Education / Library Hyper Card Templates / Open Stack / Circulation / background_2593.txt < prev    next >
Encoding:
Text File  |  1987-12-04  |  35.3 KB  |  1,041 lines

  1. -- background: 2593 from stack: in
  2. -- bmap block id: 2880
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: 
  6. ----- HyperTalk script -----
  7. ---------------------- Open Stack‚Ñ¢ Copyright 1987 ----------------------
  8. ---------------------- by the Walking Shadow Press ---------------------
  9.  
  10. on openCard
  11.   global bookNumber,fieldList, autoNumbering,tentativeBook
  12.   put the short date into field "today's Date" -- update date
  13.  
  14.   --------------------------------------------------------------------
  15.   -- The handler buttonSetOrReset sets or resets (highlights or     --
  16.   -- unhighlights) the background buttons "Returned" and "Reserved".--
  17.   --      Otherwise, they would have the same highlight status on   --
  18.   -- all cards.                                                     --
  19.   --------------------------------------------------------------------
  20.   buttonSetOrReset
  21.  
  22.   ---------------------------------------------------------------------
  23.   -- The script of a newly opened card will be empty only when a new --
  24.   -- set of cards are in the process of being created.  In that case,--
  25.   -- autonumber should never be performed.                           --
  26.   ---------------------------------------------------------------------
  27.  
  28.   if (script of this card is not empty) and (autoNumbering is true) then
  29.  
  30.     -----------------------------------------------------------------
  31.     -- If the "Book Number" field is empty and autoNumbering is    --
  32.     -- true, then the global variable bookNumber is tentatively    --
  33.     -- displayed in the "Book Number" field.  The global variable  --
  34.     -- tentativeBook is set to true while the tentative book       --
  35.     -- number is displayed.                                        --
  36.     -----------------------------------------------------------------
  37.     if field "Book Number" is empty then
  38.       put bookNumber into field "Book Number"
  39.       put true into tentativeBook
  40.     end if
  41.   end if
  42.   tabkey
  43. end openCard
  44.  
  45. on buttonSetOrReset
  46.   ----------------------------------------------------------------
  47.   -- This subroutine, called by openCard, will highlight or     --
  48.   -- unhighlight the two buttons "Returned" and "Reserved"      --
  49.   -- according to whether the two background fields of the      --
  50.   -- same name are empty or contain 1, respectively.            --
  51.   --     This enables the background buttons to act as if       --
  52.   -- they are card specific (card buttons).                     --
  53.   ----------------------------------------------------------------
  54.   if field "reserved" is 1 then
  55.     set the hilite of background button "Reserved" to true
  56.   else
  57.     set the hilite of background button "Reserved" to false
  58.   end if
  59.   if field "returned" is 1 then
  60.     set the hilite of background button "Returned" to true
  61.   else
  62.     set the hilite of background button "Returned" to false
  63.   end if
  64. end buttonSetOrReset
  65.  
  66. on closeCard
  67.   global bookNumber,fieldList,tentativeBook
  68.  
  69.   -----------------------------------------------------------------
  70.   --  The fieldSetOrReset routine acts as the complement of      --
  71.   --  buttonSetOrReset.  According to whether the buttons        --
  72.   --  "Returned" or "Reserved" are highlighted or not, the       --
  73.   --  two background fields of the same name are either loaded   --
  74.   --  with empty (unhighlighted) or 1 (highlighted) to save      --
  75.   --  the final button highlight values.                         --
  76.   --  For more, see the comments in the fieldSetOrReset routine  --
  77.   -----------------------------------------------------------------
  78.   fieldSetOrReset
  79.  
  80.   --------------------------------------------------------------------
  81.   -- If fieldList is not empty, then it means the user has entered  --
  82.   -- some information into at least one field.                      --
  83.   --------------------------------------------------------------------
  84.   if fieldList is not empty then
  85.     set cursor to 4
  86.  
  87.     ----------------------------------------------------------------
  88.     -- If tentativeBook is true, the the tentative book number    --
  89.     -- should now be made solid, that is, the book number field   --
  90.     -- should be replicated, the tentativeBook global should      --
  91.     -- be set to false, and the bookNumber global should be       --
  92.     -- incremented.                                               --
  93.     ----------------------------------------------------------------
  94.     if tentativeBook is true then
  95.       put quote&"Book Number""e&"," after fieldList
  96.       add 1 to bookNumber
  97.       put false into tentativeBook
  98.     end if
  99.  
  100.     ----------------------------------------------------------------
  101.     --  The following code will replicate the fields that appear  --
  102.     --  in the global fieldList throughout the other three        --
  103.     --  main stacks of the library system.                        --
  104.     --  fildList is created by each field upon the closeField     --
  105.     --  message.  Each changed field's name is appended onto      --
  106.     --  fieldList separated by commas from all the rest.          --
  107.     ----------------------------------------------------------------
  108.  
  109.     --  Begin by stripping off the trailing coma from fieldList:
  110.     put char 1 to (length(fieldList) - 1) of fieldList into fieldList
  111.     put fieldList into tempFieldList
  112.     put 0 into index
  113.  
  114.     put name of target into targName -- name of originating card
  115.     repeat until tempFieldList is empty
  116.       add 1 to index
  117.       put item 1 of tempFieldList into fldTemp
  118.  
  119.       -------------------------------------------------------------
  120.       --  The next field to process will alway be item 1 of the  --
  121.       --  tempFieldList list.  This results from the fact that   --
  122.       --  they're deleted off the list as they are processed,    --
  123.       --  replicated, that is.  item 1 of tempField (the next    --
  124.       --  field to replicate) was just put into fldTemp.         --
  125.       --     Next, we synthsize a line of HyerTalk that puts     --
  126.       --  the value of the field into a local variable, the      --
  127.       --  variable var(index), where index is the incrementing   --
  128.       --  index.  This will let us go to another stack while     --
  129.       --  preserving the field values for easy access in this    --
  130.       --  script.                                                --
  131.       -------------------------------------------------------------
  132.  
  133.       put "put field "&fldTemp&" of "&targName& " into var"&index into cmdLine
  134.       do cmdLine  -- Execute (Ok, interprete) the command just made.
  135.       ---------------------------------------------------------------
  136.       -- If someone can think of a better way to do the above, let --
  137.       -- me know, please.                                          --
  138.       ---------------------------------------------------------------
  139.       -- Next, empty the name of the field just processed.         --
  140.       ---------------------------------------------------------------
  141.       put empty into item 1 of tempFieldList
  142.       put empty into char 1 of tempFieldList -- rid leading comma.
  143.     end repeat
  144.  
  145.     -----------------------------------------------------------------
  146.     --  Now that we have the set of local variables (vari, where i --
  147.     --  ranges from 1 to index), we go to the other stacks and     --
  148.     --  put their values into the proper fields...                 --
  149.     -----------------------------------------------------------------
  150.     set lockScreen to true
  151.     set lockMessages to true
  152.     push card
  153.     --------------------- ACQUISITION SCREEN --------------------------
  154.     -------------------------------------------------------------------
  155.     -- The following code to replicate into the acquisition stack is --
  156.     -- similar to the code to replicate into the catalog and label   --
  157.     -- setup stacks.  Thus, they are not commented - these comments  --
  158.     -- say it all...                                                 --
  159.     -------------------------------------------------------------------
  160.     -- Line 2 of the script of this card takes us to the           --
  161.     -- card in the acquisition stack that corresponds to this one. --
  162.     -----------------------------------------------------------------
  163.  
  164.     do line 2 of script of this card
  165.  
  166.     ------------------------------------------------------------------
  167.     -- Since we have to make sure that any field we attempt to put  --
  168.     -- a value into actually exists in this stack (otherwise we'll  --
  169.     -- get an error message), we must compile a list of the         --
  170.     -- available fields of this stack...                            --
  171.     ------------------------------------------------------------------
  172.     put empty into targetFieldList
  173.     repeat with indx = 1 to the number of fields
  174.       put (word 3 of name of field indx) & "," after targetFieldList
  175.     end repeat
  176.  
  177.     ------------------------------------------------------------------
  178.     --  Next, we do the actual replication.  Provided the field in  --
  179.     --  fieldList exists in this stack (is in the list compiled     --
  180.     --  above: targetFieldList), the field's value, which is in     --
  181.     --  the variable var(indx) is put into it.                      --
  182.     ------------------------------------------------------------------
  183.     repeat with indx = 1 to index
  184.       put item indx of fieldList into tempItem
  185.       if tempItem is in targetFieldList then
  186.         put "put var"&indx&" into field "&tempItem into cmdLine
  187.         do cmdLine  -- Again, this is the only way I could figure to
  188.         --             accomplish the "put".
  189.       end if
  190.     end repeat
  191.  
  192.     ---------------------- Catalog Screen -------------------------
  193.     do line 8 of script of this card
  194.  
  195.     put empty into targetFieldList
  196.     repeat with indx = 1 to the number of fields
  197.       put (word 3 of name of field indx) & "," after targetFieldList
  198.     end repeat
  199.  
  200.     repeat with indx = 1 to index
  201.       put item indx of fieldList into tempItem
  202.       if tempItem is in targetFieldList then
  203.         put "put var"&indx&" into field "&tempItem into cmdLine
  204.         do cmdLine
  205.       end if
  206.     end repeat
  207.     ---------------------- Label Screen -------------------------
  208.     do line 11 of script of this card
  209.  
  210.     put empty into targetFieldList
  211.     repeat with indx = 1 to the number of fields
  212.       put (word 3 of name of field indx) & "," after targetFieldList
  213.     end repeat
  214.  
  215.     repeat with indx = 1 to index
  216.       put item indx of fieldList into tempItem
  217.       if tempItem is in targetFieldList then
  218.         put "put var"&indx&" into field "&tempItem into cmdLine
  219.         do cmdLine
  220.       end if
  221.     end repeat
  222.     send innerReplication to this card
  223.     ------------------------------------------------------------------
  224.     pop card
  225.     set lockMessages to false
  226.     set lockScreen to false
  227.  
  228.   end if
  229.  
  230.   ---------------------------------------------------------------
  231.   -- If we have tentatively numbered this card, but the user   --
  232.   -- hasn't changed anything, we want to leave the card alone  --
  233.   -- and do nothing to global bookNumber.                      --
  234.   --  So, empty field "Book Number" of its tentative number    --
  235.   -- and put false into tentativeBook because the card we      --
  236.   -- are about to go to may have a solid number.               --
  237.   ---------------------------------------------------------------
  238.  
  239.   if tentativeBook is true then
  240.     put empty into field "Book Number"
  241.     put false into tentativeBook
  242.   end if
  243.  
  244.   ---------------------------------------------------------------
  245.   --  Finally, we empty global fieldList because the fields    --
  246.   --  have been replicated.                                    --
  247.   ---------------------------------------------------------------
  248.   put empty into fieldList
  249. end closeCard
  250.  
  251. on fieldSetOrReset
  252.   -------------------------------------------------------------------
  253.   --  This subroutine tests the buttons "Returned" and "Reserved"  --
  254.   --  and set the fields of the same name to emtpy or 1 according  --
  255.   --  to whether the buttons are highlighted (1) or unhighlighted  --
  256.   --  (empty).  This is part of a scheme to make the background    --
  257.   --  buttons appear as if they are card buttons without having    --
  258.   --  to create them on each card.                                 --
  259.   -------------------------------------------------------------------
  260.   if the hilite of background button "Reserved" is true then
  261.     put 1 into field "reserved"
  262.   else
  263.     put empty into field "reserved"
  264.   end if
  265.   if the hilite of background button "Returned" is true then
  266.     put 1 into field "Returned"
  267.   else
  268.     put empty into field "Returned"
  269.   end if
  270. end fieldSetOrReset
  271.  
  272. on newField
  273.   ----------------------------------------------------------------------
  274.   --  This handler guides the process of creating a new (background)  --
  275.   --  field.  In order for the field replication to work, the field   --
  276.   --  must have a name.  So, the field script that appends the        --
  277.   --  field's name onto the global fieldList is not inserted into the --
  278.   --  script of an unnamed field.  An answer box warns the user of    --
  279.   --  this.                                                           --
  280.   ----------------------------------------------------------------------
  281.   global fieldScript
  282.   put name of target into targName
  283.   if word 1 of targName is "bkgnd" then
  284.     ask "Name of field?"
  285.     put it into tmpFldName
  286.     if tmpFldName is empty then
  287.       answer "Unnamed; field will not copy to other stacks"
  288.     else
  289.       set name of targName to tmpFldName
  290.       set script of targName to fieldScript
  291.     end if
  292.   end if
  293. end newField
  294.  
  295. on doMenu parm
  296.   -----------------------------------------------------------------
  297.   --  Some of the menu selections have been redefined, and the   --
  298.   --  Cut Card selection has been neutralized due to the fact    --
  299.   --  it could cause extensive damage to the library database.   --
  300.   -----------------------------------------------------------------
  301.   --  The following condition (name of this card is name of      --
  302.   --  target) will be true only if the menu selection is made    --
  303.   --  while in the current stack.  This is needed becasue we     --
  304.   --  want the redefined menu functions to work only when the    --
  305.   --  menu selection is made from the current stack.  Otherwise  --
  306.   --  we need the HyperCard menu interpretation.  See the final  --
  307.   --  "else", which passes the doMenu message to HyperCard.      --
  308.   -----------------------------------------------------------------
  309.   if name of this card is name of target then
  310.     if parm is "New Card" then
  311.       ------------------------------------------------------------
  312.       --  The "New Card" selections is redefined and controlled --
  313.       --  by the stack script handler mkNewCard.                --
  314.       ------------------------------------------------------------
  315.       mkNewCard
  316.     else
  317.       if parm is "Delete Card" then
  318.         --------------------------------------------------------
  319.         --  The "Delete Card" selection is controlled by the  --
  320.         --  stack script handler delCard.                     --
  321.         --------------------------------------------------------
  322.         delCard
  323.       else
  324.         -------------------------------------------------------
  325.         -- New fields will always be background fields...    --
  326.         -------------------------------------------------------
  327.         if parm is "New Field" then
  328.           set editBkgnd to true
  329.           pass doMenu  -- let HyperCard make the field.
  330.         else
  331.           --------------------------------------------------------
  332.           -- If the "Open Stack..." selection is made, the user --
  333.           -- may be trying to escape from the program before    --
  334.           -- the global variables have been saved on the control--
  335.           -- card, and we can't let that happen.                --
  336.           -- So, we automatically call the quit handler, which  --
  337.           -- saves the globals.                                 --
  338.           --------------------------------------------------------
  339.           if parm is "Open Stack..." then
  340.             set cursor to 4
  341.             quit
  342.             pass doMenu -- Now let the user do what she or he wants.
  343.           else
  344.             if parm is "Cut Card" then
  345.               --------------------------------------------------------
  346.               -- "Cut Card" is presently deactivated, it could mess --
  347.               -- the database up by cutting a card out of one stack --
  348.               -- and not all the others.                            --
  349.               --------------------------------------------------------
  350.               -- (cut card conditional)
  351.             else
  352.               if parm is "Paste Card" then
  353.                 --
  354.               else
  355.                 -----------------------------------------------------
  356.                 --  If the user selects some other menu selection, --
  357.                 --  let HyperCard take care of it...               --
  358.                 -----------------------------------------------------
  359.                 pass doMenu
  360.               end if
  361.             end if
  362.           end if
  363.         end if
  364.       end if
  365.     end if
  366.   else
  367.     ---------------------------------------------------------------
  368.     -- If the selection was originally made outside this stack,  --
  369.     -- then do the HyperCard selection.                          --
  370.     ---------------------------------------------------------------
  371.     pass doMenu
  372.   end if
  373. end doMenu
  374.  
  375. on processField param
  376.   ------------------------------------------------------------------
  377.   --  This is a utility-like handler that deletes empty lines and --
  378.   --  white-space out of the field given in param.                --
  379.   ------------------------------------------------------------------
  380.   repeat with i = the number of lines in field param down to 1
  381.     if word 1 of line i of field param is empty then
  382.       delete line i of field param
  383.     end if
  384.   end repeat
  385. end processField
  386.  
  387. function scrollLine
  388. return (((item 2 of the clickLoc - item 2 of the rect of the target) div the textHeight of the target) + 1 + trunc(scroll of the target/ the textHeight of the target))
  389. end scrollLine
  390.  
  391.  
  392. --------------------- End Open Stack scripts  --------------------------
  393.  
  394.  
  395.  
  396. -- part 3 (field)
  397. -- low flags: 00
  398. -- high flags: 4007
  399. -- rect: left=96 top=138 right=277 bottom=401
  400. -- title width / last selected line: 0
  401. -- icon id / first selected line: 0 / 0
  402. -- text alignment: 0
  403. -- font id: 3
  404. -- text size: 10
  405. -- style flags: 256
  406. -- line height: 13
  407. -- part name: Circ Field
  408. ----- HyperTalk script -----
  409. on closeField
  410.   global fieldList
  411.   put word 3 of name of me into tempName
  412.   if not(fieldList contains tempName) then
  413.     put (word 3 of name of me) & "," after fieldList
  414.   end if
  415. end closeField
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423. -- part 1 (field)
  424. -- low flags: 00
  425. -- high flags: 0002
  426. -- rect: left=124 top=40 right=104 bottom=176
  427. -- title width / last selected line: 0
  428. -- icon id / first selected line: 0 / 0
  429. -- text alignment: 0
  430. -- font id: 2
  431. -- text size: 12
  432. -- style flags: 256
  433. -- line height: 16
  434. -- part name: Call number
  435. ----- HyperTalk script -----
  436. on closeField
  437.   global fieldList
  438.   put word 3 of name of me into tempName
  439.   if not(fieldList contains tempName) then
  440.     put (word 3 of name of me) & "," after fieldList
  441.   end if
  442. end closeField
  443.  
  444.  
  445. -- part 2 (field)
  446. -- low flags: 00
  447. -- high flags: 0002
  448. -- rect: left=176 top=40 right=72 bottom=364
  449. -- title width / last selected line: 0
  450. -- icon id / first selected line: 0 / 0
  451. -- text alignment: 0
  452. -- font id: 2
  453. -- text size: 12
  454. -- style flags: 256
  455. -- line height: 16
  456. -- part name: Author
  457. ----- HyperTalk script -----
  458. on closeField
  459.   global fieldList
  460.   put word 3 of name of me into tempName
  461.   if not(fieldList contains tempName) then
  462.     put (word 3 of name of me) & "," after fieldList
  463.   end if
  464. end closeField
  465.  
  466.  
  467. -- part 5 (button)
  468. -- low flags: 00
  469. -- high flags: 8003
  470. -- rect: left=386 top=305 right=327 bottom=509
  471. -- title width / last selected line: 0
  472. -- icon id / first selected line: 0 / 0
  473. -- text alignment: 1
  474. -- font id: 0
  475. -- text size: 12
  476. -- style flags: 0
  477. -- line height: 16
  478. -- part name: Catalog Screen
  479. ----- HyperTalk script -----
  480. on mouseUp
  481.   goCat
  482. end mouseUp
  483.  
  484.  
  485. -- part 6 (button)
  486. -- low flags: 00
  487. -- high flags: 8003
  488. -- rect: left=260 top=304 right=327 bottom=385
  489. -- title width / last selected line: 0
  490. -- icon id / first selected line: 0 / 0
  491. -- text alignment: 1
  492. -- font id: 0
  493. -- text size: 12
  494. -- style flags: 0
  495. -- line height: 16
  496. -- part name: Acquisition Screen
  497. ----- HyperTalk script -----
  498. on mouseUp
  499.   goAcq
  500. end mouseUp
  501.  
  502.  
  503. -- part 7 (button)
  504. -- low flags: 00
  505. -- high flags: 8003
  506. -- rect: left=104 top=306 right=327 bottom=203
  507. -- title width / last selected line: 0
  508. -- icon id / first selected line: 0 / 0
  509. -- text alignment: 1
  510. -- font id: 0
  511. -- text size: 12
  512. -- style flags: 0
  513. -- line height: 16
  514. -- part name: Overdue Card
  515. ----- HyperTalk script -----
  516. on mouseUp
  517.   set lockScreen to true
  518.   processField "Circ Field"
  519.   put last line of field "Circ Field" into lastLine
  520.   put word 3 of lastLine into patronNumber
  521.   put patronNumber into field "Patron Number"
  522.   go to stack "Overdue"
  523.   find patronNumber in field "Patron Number"
  524.   set lockScreen to false
  525. end mouseUp
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. -- part 8 (button)
  533. -- low flags: 00
  534. -- high flags: 8003
  535. -- rect: left=5 top=306 right=327 bottom=102
  536. -- title width / last selected line: 0
  537. -- icon id / first selected line: 0 / 0
  538. -- text alignment: 1
  539. -- font id: 0
  540. -- text size: 12
  541. -- style flags: 0
  542. -- line height: 16
  543. -- part name: Patron Card
  544. ----- HyperTalk script -----
  545. on mouseUp
  546.   set lockScreen to true
  547.   processField "Circ Field"
  548.   put last line of field "Circ Field" into lastLine
  549.   put word 3 of lastLine into patronNumber
  550.   put patronNumber into field "Patron Number"
  551.   go to stack "Patron"
  552.   find patronNumber in field "Patron Number"
  553.   set lockScreen to false
  554. end mouseUp
  555.  
  556.  
  557.  
  558. -- part 9 (field)
  559. -- low flags: 00
  560. -- high flags: 0002
  561. -- rect: left=176 top=71 right=119 bottom=365
  562. -- title width / last selected line: 0
  563. -- icon id / first selected line: 0 / 0
  564. -- text alignment: 0
  565. -- font id: 2
  566. -- text size: 12
  567. -- style flags: 256
  568. -- line height: 16
  569. -- part name: title
  570. ----- HyperTalk script -----
  571. on closeField
  572.   global fieldList
  573.   put word 3 of name of me into tempName
  574.   if not(fieldList contains tempName) then
  575.     put (word 3 of name of me) & "," after fieldList
  576.   end if
  577. end closeField
  578.  
  579.  
  580. -- part 13 (button)
  581. -- low flags: 00
  582. -- high flags: 0000
  583. -- rect: left=233 top=304 right=327 bottom=258
  584. -- title width / last selected line: 0
  585. -- icon id / first selected line: 27009 / 27009
  586. -- text alignment: 1
  587. -- font id: 0
  588. -- text size: 12
  589. -- style flags: 0
  590. -- line height: 16
  591. -- part name: Next
  592. ----- HyperTalk script -----
  593. on mouseUp
  594.   go to next card
  595. end mouseUp
  596.  
  597.  
  598.  
  599. -- part 14 (button)
  600. -- low flags: 00
  601. -- high flags: 0000
  602. -- rect: left=205 top=304 right=327 bottom=231
  603. -- title width / last selected line: 0
  604. -- icon id / first selected line: 9301 / 9301
  605. -- text alignment: 1
  606. -- font id: 0
  607. -- text size: 12
  608. -- style flags: 0
  609. -- line height: 16
  610. -- part name: Prev
  611. ----- HyperTalk script -----
  612. on mouseUp
  613.   go to prev card
  614. end mouseUp
  615.  
  616.  
  617.  
  618. -- part 15 (field)
  619. -- low flags: 00
  620. -- high flags: 0002
  621. -- rect: left=124 top=103 right=119 bottom=176
  622. -- title width / last selected line: 0
  623. -- icon id / first selected line: 0 / 0
  624. -- text alignment: 0
  625. -- font id: 2
  626. -- text size: 12
  627. -- style flags: 256
  628. -- line height: 16
  629. -- part name: Book Number
  630. ----- HyperTalk script -----
  631. on closeField
  632.   global fieldList,bookNumber,tentativeBook
  633.   if tentativeBook is true then
  634.     put field "Book Number" into bookNumber
  635.   else
  636.  
  637.     put word 3 of name of me into tempName
  638.     if not(fieldList contains tempName) then
  639.       put (word 3 of name of me) & "," after fieldList
  640.     end if
  641.   end if
  642. end closeField
  643.  
  644.  
  645. -- part 21 (button)
  646. -- low flags: 00
  647. -- high flags: 8003
  648. -- rect: left=24 top=196 right=220 bottom=89
  649. -- title width / last selected line: 0
  650. -- icon id / first selected line: 0 / 0
  651. -- text alignment: 1
  652. -- font id: 0
  653. -- text size: 12
  654. -- style flags: 0
  655. -- line height: 16
  656. -- part name: Sort
  657. ----- HyperTalk script -----
  658. on mouseUp
  659.   ask "Sort on which field?" with "Book Number"
  660.   put it into fld
  661.   if it is not empty then
  662.     answer "Sort fields" with "Descending" or "Ascending"
  663.     if it is "Ascending" then
  664.       sort ascending by field fld
  665.     else
  666.       sort descending by field fld
  667.     end if
  668.   end if
  669. end mouseUp
  670.  
  671.  
  672.  
  673. -- part 27 (button)
  674. -- low flags: 00
  675. -- high flags: 8003
  676. -- rect: left=9 top=170 right=191 bottom=103
  677. -- title width / last selected line: 0
  678. -- icon id / first selected line: 0 / 0
  679. -- text alignment: 1
  680. -- font id: 0
  681. -- text size: 12
  682. -- style flags: 0
  683. -- line height: 16
  684. -- part name: Check Out
  685. ----- HyperTalk script -----
  686. ----------------------- Open Stack‚Ñ¢ Copyright 1987 ---------------------
  687. ----------------------- by the Walking Shadow Press --------------------
  688. on mouseUp
  689.   --------------------------------------------------------------
  690.   --  If the book has not been returned yet, it cannot be     --
  691.   --  checked out...                                          --
  692.   --------------------------------------------------------------
  693.   if the hilite of background button "Returned" is false then
  694.     answer "This Book has not been returned."
  695.     exit mouseUp
  696.   end if
  697.   -------------------------------------------------
  698.   --  Otherwise, the book is to be checked out.  --
  699.   -------------------------------------------------
  700.  
  701.   processField "Reserve Field" -- Tidy up the reserve field.
  702.  
  703.   -----------------------------------------------------------------
  704.   --  The due date is calculated by converting today's date to   --
  705.   --  seconds and adding the appropriate number of seconds to    --
  706.   --  give the future due date...                                --
  707.   -----------------------------------------------------------------
  708.   put the short date into todayDate
  709.   put todayDate into dueDate
  710.   convert dueDate to seconds
  711.   add ((field "Check Out") * 24 * 60 * 60) to dueDate
  712.   convert dueDate to short date
  713.  
  714.   --------------------------------------------------------------------
  715.   --  If the reserved button is not on, the book will be manually   --
  716.   --  checked out to a patron.  If it is on, and the reserve field  --
  717.   --  isn't empty, the book is automatically checked out to the     --
  718.   --  next patron on the reserve list.                              --
  719.   --      Also, if there are no more patron numbers in the reserve  --
  720.   --  list, the reserve button is unhighlighted.                    --                                 --
  721.   --------------------------------------------------------------------
  722.   put empty into patronNumber
  723.   if (the hilite of background button "reserved") is not true then
  724.     ask "to patron number?"
  725.     put It into patronNumber
  726.     if patronNumber is empty then
  727.       exit mouseUp
  728.     else
  729.       type " " & todayDate & "    " & dueDate&"       "&patronNumber
  730.     end if
  731.  
  732.   else                          -- The reserved condition is true...
  733.  
  734.     if (field "reserve field" is not empty) then
  735.       put " " & todayDate & "    " & dueDate&"       " & first line of field "reserve field" after field "Circ Field"
  736.       delete first line of field "reserve field"
  737.     else
  738.       set the hilite of background button "reserved" to false
  739.     end if
  740.     ------------------------------------------------------------------
  741.     --  The last patron number on the reserve list might have just  --
  742.     --  been deleted.  If so, unhighlight the reserve button.       --
  743.     ------------------------------------------------------------------
  744.     if field "reserve field" is empty then
  745.       set the hilite of background button "reserved" to false
  746.     end if
  747.   end if
  748.   ---------------------------------------------------------------
  749.   --  The book has just been checked out, so unhightlight the  --
  750.   --  returned button.                                         --
  751.   ---------------------------------------------------------------
  752.   set the hilite of background button "returned" to false
  753. end mouseUp
  754.  
  755.  
  756. -- part 45 (field)
  757. -- low flags: 00
  758. -- high flags: 0002
  759. -- rect: left=424 top=235 right=250 bottom=469
  760. -- title width / last selected line: 0
  761. -- icon id / first selected line: 0 / 0
  762. -- text alignment: 0
  763. -- font id: 20
  764. -- text size: 12
  765. -- style flags: 256
  766. -- line height: 16
  767. -- part name: Check Out
  768. ----- HyperTalk script -----
  769. on closeField
  770.   global fieldList
  771.   put word 3 of name of me into tempName
  772.   if not(fieldList contains tempName) then
  773.     put (word 3 of name of me) & "," after fieldList
  774.   end if
  775. end closeField
  776.  
  777.  
  778. -- part 46 (field)
  779. -- low flags: 00
  780. -- high flags: 0007
  781. -- rect: left=378 top=117 right=213 bottom=496
  782. -- title width / last selected line: 0
  783. -- icon id / first selected line: 0 / 0
  784. -- text alignment: 0
  785. -- font id: 3
  786. -- text size: 12
  787. -- style flags: 0
  788. -- line height: 16
  789. -- part name: Reserve Field
  790. ----- HyperTalk script -----
  791. on closeField
  792.   global fieldList
  793.   put word 3 of name of me into tempName
  794.   if not(fieldList contains tempName) then
  795.     put (word 3 of name of me) & "," after fieldList
  796.   end if
  797. end closeField
  798.  
  799.  
  800. -- part 48 (field)
  801. -- low flags: 01
  802. -- high flags: 0002
  803. -- rect: left=12 top=109 right=125 bottom=101
  804. -- title width / last selected line: 0
  805. -- icon id / first selected line: 0 / 0
  806. -- text alignment: 0
  807. -- font id: 3
  808. -- text size: 12
  809. -- style flags: 0
  810. -- line height: 16
  811. -- part name: Today's Date
  812.  
  813.  
  814. -- part 50 (field)
  815. -- low flags: 80
  816. -- high flags: 0000
  817. -- rect: left=377 top=51 right=77 bottom=474
  818. -- title width / last selected line: 0
  819. -- icon id / first selected line: 0 / 0
  820. -- text alignment: 0
  821. -- font id: 3
  822. -- text size: 12
  823. -- style flags: 0
  824. -- line height: 16
  825. -- part name: Returned
  826.  
  827.  
  828. -- part 51 (field)
  829. -- low flags: 80
  830. -- high flags: 0000
  831. -- rect: left=379 top=86 right=111 bottom=477
  832. -- title width / last selected line: 0
  833. -- icon id / first selected line: 0 / 0
  834. -- text alignment: 0
  835. -- font id: 3
  836. -- text size: 12
  837. -- style flags: 0
  838. -- line height: 16
  839. -- part name: Reserved
  840.  
  841.  
  842. -- part 52 (button)
  843. -- low flags: 00
  844. -- high flags: A005
  845. -- rect: left=385 top=54 right=75 bottom=480
  846. -- title width / last selected line: 0
  847. -- icon id / first selected line: 0 / 0
  848. -- text alignment: 1
  849. -- font id: 0
  850. -- text size: 12
  851. -- style flags: 0
  852. -- line height: 16
  853. -- part name: Reserved
  854. ----- HyperTalk script -----
  855. on mouseUp
  856.   -------------------------------------------------------------
  857.   --  If this button is checked (highlighted), then ask for  --
  858.   --  a patron number to reserve the book for.  If the       --
  859.   --  supplied patron number is not empty, append it to the  --
  860.   --  reserve list.                                          --
  861.   -------------------------------------------------------------
  862.   if hilite of me is true then
  863.     ask "For which patron (number)?"
  864.     put it into patronNumber
  865.     processField "Reserve Field"
  866.     if patronNumber is not empty
  867.     then put return&patronNumber after field "Reserve Field"
  868.   end if
  869. end mouseUp
  870.  
  871.  
  872.  
  873. -- part 53 (button)
  874. -- low flags: 00
  875. -- high flags: A005
  876. -- rect: left=385 top=27 right=51 bottom=480
  877. -- title width / last selected line: 0
  878. -- icon id / first selected line: 0 / 0
  879. -- text alignment: 1
  880. -- font id: 0
  881. -- text size: 12
  882. -- style flags: 0
  883. -- line height: 16
  884. -- part name: Returned
  885. ----- HyperTalk script -----
  886. on mouseUp
  887.   ------------------------------------------------------------------
  888.   --  If a book has been returned and is on reserve, a reserve    --
  889.   --  notice is generated for it.                                 --
  890.   ------------------------------------------------------------------
  891.   if hilite of me is true then
  892.     ---------------------------------------------------------------
  893.     --  First tidy up the reserve field, and if it's not empty,  --
  894.     --  and the reserve button is on, generate a notice.         --
  895.     ---------------------------------------------------------------
  896.     processField "Reserve Field"
  897.     if (field "Reserve Field" is not empty) and (the hilite of background button "Reserved" is true) then
  898.       put "Generating reserve notice." into msg
  899.  
  900.       ----------------------------------------------------------------
  901.       --  Gather some info. on the circulation card for the notice. --
  902.       ----------------------------------------------------------------
  903.       put first line of field "Reserve Field" into patronNumber
  904.       put field "Book Number" into bookNum
  905.       put field "Title" into title
  906.       put the date into todayDate
  907.       put todayDate into holdDate
  908.       --------------------------------------------------------------
  909.       --  If nothing has been entered into the "Holding Period"   --
  910.       --  field, ask for something.  If still nothing is entered, --
  911.       --  leave holdDate as todayDate.                            --
  912.       --------------------------------------------------------------
  913.       if field "Holding Period" is empty then
  914.         ask "Enter the reserve holding period."
  915.         if it is not empty then
  916.           put it into field "Holding Period"
  917.           convert holdDate to seconds
  918.           add 60*60*24*field "Holding Period" to holdDate
  919.           convert holdDate to short date
  920.         end if
  921.       end if
  922.  
  923.       -------------------------------------------------------------
  924.       --  Next we go to the "Patron" stack to gather more info.  --
  925.       --  on the patron.                                         --
  926.       -------------------------------------------------------------
  927.       set lockScreen to true
  928.       push card
  929.  
  930.       go to stack "Patron"
  931.       find patronNumber in field "Patron Number"
  932.       -------------------------------------------------------------
  933.       --
  934.       if patronNumber is field "Patron Number" then
  935.         put field "Patron Name" into patronName
  936.         put field "Patron Address" into patronAddress
  937.  
  938.         go to stack "Reserve Note"
  939.         doMenu "New Card"
  940.         put patronName into field "Patron Name 1"
  941.         put patronAddress into field "Patron Address"
  942.         put todayDate into field "today's date"
  943.         put patronName into field "Patron Name 2"
  944.         put title into field "Title"
  945.         put holdDate into field "Hold Date"
  946.         put bookNum into field "Book Number"
  947.         put patronNumber into field "Patron Number"
  948.       else
  949.         -- Error , Patron does not exist.
  950.         answer "The top patron number does not exist."
  951.       end if
  952.       pop card
  953.       set lockScreen to false
  954.       hide msg
  955.     end if
  956.   end if
  957. end mouseUp
  958.  
  959.  
  960.  
  961. -- part 54 (field)
  962. -- low flags: 80
  963. -- high flags: 0000
  964. -- rect: left=156 top=120 right=205 bottom=356
  965. -- title width / last selected line: 0
  966. -- icon id / first selected line: 0 / 0
  967. -- text alignment: 0
  968. -- font id: 3
  969. -- text size: 12
  970. -- style flags: 0
  971. -- line height: 16
  972. -- part name: Patron Number
  973. ----- HyperTalk script -----
  974. on closeField
  975.   global fieldList
  976.   put word 3 of name of me into tempName
  977.   if not(fieldList contains tempName) then
  978.     put (word 3 of name of me) & "," after fieldList
  979.   end if
  980. end closeField
  981.  
  982.  
  983. -- part 55 (button)
  984. -- low flags: 00
  985. -- high flags: 8003
  986. -- rect: left=35 top=225 right=246 bottom=76
  987. -- title width / last selected line: 0
  988. -- icon id / first selected line: 0 / 0
  989. -- text alignment: 1
  990. -- font id: 0
  991. -- text size: 12
  992. -- style flags: 0
  993. -- line height: 16
  994. -- part name: Help!
  995. ----- HyperTalk script -----
  996. on mouseUp
  997.   go to stack "Circulation Help"
  998. end mouseUp
  999.  
  1000.  
  1001.  
  1002. -- part 56 (field)
  1003. -- low flags: 00
  1004. -- high flags: 0002
  1005. -- rect: left=386 top=85 right=103 bottom=439
  1006. -- title width / last selected line: 0
  1007. -- icon id / first selected line: 0 / 0
  1008. -- text alignment: 0
  1009. -- font id: 3
  1010. -- text size: 12
  1011. -- style flags: 0
  1012. -- line height: 16
  1013. -- part name: Holding Period
  1014. ----- HyperTalk script -----
  1015. on closeField
  1016.   global fieldList
  1017.   put word 3 of name of me into tempName
  1018.   if not(fieldList contains tempName) then
  1019.     put (word 3 of name of me) & "," after fieldList
  1020.   end if
  1021. end closeField
  1022.  
  1023.  
  1024. -- part 59 (button)
  1025. -- low flags: 00
  1026. -- high flags: 8003
  1027. -- rect: left=196 top=327 right=342 bottom=276
  1028. -- title width / last selected line: 0
  1029. -- icon id / first selected line: 0 / 0
  1030. -- text alignment: 1
  1031. -- font id: 0
  1032. -- text size: 12
  1033. -- style flags: 0
  1034. -- line height: 16
  1035. -- part name: Control
  1036. ----- HyperTalk script -----
  1037. on mouseUp
  1038.   go to stack "Control"
  1039. end mouseUp
  1040.  
  1041.